package dmir.reaction.publico.xml;

public class Entity{
	
	public String etype;
	public String ename;
	public int id;
	
	public Entity(String etype, String ename, int id) {
		super();
		this.etype = etype;
		this.ename = ename;
		this.id = id;		
	}
	
	public String toString() {
		return String.valueOf(this.id)+':'+this.etype+':'+this.ename;
	}

	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((ename == null) ? 0 : ename.hashCode());
		result = prime * result + ((etype == null) ? 0 : etype.hashCode());
		result = prime * result + id;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		
		if (this == obj)
			return true;
		
		if (obj == null)
			return false;
		
		if (getClass() != obj.getClass())
			return false;
		
		Entity other = (Entity) obj;
		
		if (ename == null) {
			if (other.ename != null)
				return false;
			
		} else if (!ename.equals(other.ename))
			return false;
		
		if (etype == null) {
			if (other.etype != null)
				return false;
		} else if (!etype.equals(other.etype))
			return false;
		
		if (id != other.id)
			return false;
		
		return true;
	}

		
}